import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

import Layout from '../views/layout/Layout'

export const constantRouterMap = [{
    path: '/404',
    component: () =>
      import('@/views/404'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    name: 'home',
    meta: {
      title: '商户首页',
      icon: 'home'
    },
    children: [{
      path: 'home',
      component: () =>import('@/views/home/index')
    }]
  },
  {
    path: '/order',
    component: Layout,
    redirect: '/order/advertising',
    name: 'order',
    meta: {
      title: '订单管理',
      icon: 'order'
    },
    children: [{
        path: 'advertising',
        name: 'advertising',
        component: () =>
          import('@/views/order/advertising'),
        meta: {
          title: '广告投放管理',
          icon: 'cc-right'
        }
      },
      {
        path: 'qualifications',
        name: 'qualifications',
        component: () =>
          import('@/views/order/qualifications'),
        meta: {
          title: '企业资质管理',
          icon: 'cc-right'
        }
      },
      {
        path: 'dataAnalysis',
        name: 'dataAnalysis',
        component: () =>
          import('@/views/order/dataAnalysis'),
        meta: {
          title: '数据分析',
          icon: 'cc-right'
        }
      }
    ]
  },
  {
    path: '/advertising',
    component: Layout,
    redirect: '/advertising/create',
    name: 'advertisingTF',
    meta: {
      title: '广告投放',
      icon: 'cards-outline'
    },
    children: [{
        path: 'create',
        name: 'create',
        component: () =>
          import('@/views/advertising/create'),
        meta: {
          title: '新建广告',
          icon: 'cc-right'
        }
      }
    ]
  },
  {
    path: '/account',
    component: Layout,
    redirect: '/account/userinfo',
    name: 'account',
    meta: {
      title: '账户管理',
      icon: 'settings'
    },
    children: [{
      path: 'userinfo',
      name: 'userinfo',
      component: () =>
        import('@/views/account/userinfo'),
      meta: {
        title: '商家账户',
        icon: 'cc-right'  
      }
    }, {
      path: 'password',
      name: 'password',
      component: () =>
        import('@/views/account/password'),
      meta: {
        title: '修改密码',
        icon: 'cc-right'
      }
    }, {
      path: 'recharge',
      name: 'recharge',
      component: () =>
        import('@/views/account/recharge'),
      meta: {
        title: '金额充值',
        icon: 'cc-right'
      }
    }, {
      path: 'Bill',
      name: 'Bill',
      component: () =>
        import('@/views/account/Bill'),
      meta: {
        title: '账单流水',
        icon: 'cc-right'
      }
    }]
  },
  {
    path: '/',
    component: Layout,
    redirect: '/advertisingDetails',
    name: 'advertisingDetails',
    hidden: true,
    meta: {
      title: '订单详情',
      icon: 'advertisingDetails'
    },
    children: [{
      path: 'advertisingDetails',
      component: () =>import('@/views/advertising/advertisingDetails')
    }]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

export default new Router({
  // mode: 'history', //hash
  scrollBehavior: () => ({
    y: 0
  }),
  routes:constantRouterMap

})
